// fiename: YQTcpSession.h
// author: enic
// date: 2015-12-01

#pragma once

#include "tstdlib.h"
#include "YQPacketBase.h"
#include "../XAsyncSocket/XAsyncSocketExports.h"

class YQTcpSession
{
public:
	YQTcpSession();

public:
	void Connect(const std::tstring& strIp, uint16_t nPort);
	void Disconnect();
	void SendCmd(WORD wMainId, WORD wSubId);
	void SendCmd(WORD wMainId, WORD wSubId, void* pData, WORD wDataSize);


public:
	bool OnRecvCmd(WORD wMainId, WORD wSubId, void* pData, WORD wDataSize);
	void __WriteSink();
	void __ReadSink();

private:
	XEndPoint m_endPoint;
	XAsyncSocket* m_pSocket;
};